package com.shxt.framework.commons.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Pager {
	/** 当前页 **/
	private int pageNow = 1;
	/** 每页显示条数 **/
	private int pageSize = 2;
	/** 总记录数 **/
	private int totalCount;
	/** 总页数 **/
	private int totalPages;
	/** (pageNow-1)*pageSize Limit offset,pageSize **/
	private int offset;
	private List<?> datas;
	/** 用来存储查询条件query['KEY值'] **/
	private Map<String, String> query = new HashMap<>();



	public int getPageNow() {
		return this.pageNow;
	}
	public void setPageNow( int pageNow ) {
		this.pageNow = pageNow;
	}
	public int getPageSize() {
		return this.pageSize;
	}
	public void setPageSize( int pageSize ) {
		this.pageSize = pageSize;
	}
	public int getTotalCount() {
		return this.totalCount;
	}
	public void setTotalCount( int totalCount ) {
		this.totalCount = totalCount;
	}
	public int getTotalPages() {
		return this.totalCount%this.pageSize==0?this.totalCount/this.pageSize:this.totalCount/this.pageSize+1;
	}
	public void setTotalPages( int totalPages ) {
		this.totalPages = totalPages;
	}
	public int getOffset() {
		return (this.pageNow-1)*this.pageSize;
	}
	public void setOffset( int offset ) {
		this.offset = offset;
	}
	public List<?> getDatas() {
		return this.datas;
	}
	public void setDatas( List<?> datas ) {
		this.datas = datas;
	}
	public Map<String, String> getQuery() {
		return this.query;
	}
	public void setQuery( Map<String, String> query ) {
		this.query = query;
	}
	@Override
	public String toString() {
		return "Pager [pageNow=" + this.pageNow + ", pageSize=" + this.pageSize + ", totalCount=" + this.totalCount
				+ ", totalPages=" + this.totalPages + ", offset=" + this.offset + ", datas=" + this.datas + ", query="
				+ this.query + "]";
	}
}
